Skip to content

Update @electric-sql/pglite to 0.3.16 - #11666

Open
mtr002 wants to merge 1 commit into
mainfrom
pglite-0-3-16-bump
Open

mtr002 wants to merge 1 commit into
mainfrom
pglite-0-3-16-bump

Conversation

@mtr002

@mtr002 mtr002 commented Dec 5, 2026

Copy link
Copy Markdown
Member

Description

Updates @electric-sql/pglite from ^0.3.3 to 0.3.16 (PostgreSQL 17.5) and updates the reported serverVersion in src/emulator/dataconnect/pgliteServer.ts to 17.5 (PGlite 0.3.16).

Pins @electric-sql/pglite-tools to 0.2.4. In this repo, @electric-sql/pglite-tools is only used by migrateDb() in src/emulator/dataconnect/pgliteServer.ts to run pgDump against pglite-2 (@electric-sql/pglite@0.2.17, PostgreSQL 16) when migrating legacy PG16 data directories to PG17. Newer @electric-sql/pglite-tools releases (0.2.5 through 0.2.21) pin an exact @electric-sql/pglite 0.3.x peer dependency, and the newer Emscripten pg_dump in 0.2.21 sends raw PostgreSQL startup packets directly to execProtocolRawSync, which crashes pglite-2@0.2.17 with a WASM trap. Pinning 0.2.4 (the WASI release paired with PGlite 0.2.17) avoids peer dependency conflicts with 0.3.16 and keeps PG16-to-PG17 migration working without changing migration logic.

This PR is a dependency bump only and leaves the existing Data Connect GraphQL emulator path and extension list unchanged.

High-level PGlite technical requirements for experimental SQL Connect emulator support

This dependency bump is the first step toward supporting the experimental SQL Connect local emulator (gated behind the fdcsqlconnect experiment). Subsequent PRs will add an opt-in PGlite connection layer for SQL Connect without modifying the existing Data Connect GraphQL emulator path.

Key technical requirements for local PGlite support:

  • PostgreSQL 17.5 runtime and bundled extensions: Stay on PGlite 0.3.x (preserving compatibility with existing 0.3.3 local data directories and PG16-to-PG17 migration) and support standard bundled extensions (vector, uuid-ossp, pgcrypto, pg_trgm, citext, hstore, ltree, unaccent, btree_gin, btree_gist).
  • Per-connection transaction and extended-query isolation: Prevent concurrent TCP clients (emulator connections, migrations, seed runs, and local SQL tools) from interleaving transactions, multi-statement queries, or extended-protocol batches on PGlite's single WASM session.
  • Per-connection prepared statement isolation: Prevent named and unnamed prepared statements (including multi-round-trip unnamed statements) from colliding across connections, and ensure client disconnects or DEALLOCATE / DISCARD ALL do not invalidate other connections' statements.
  • Error recovery and disconnect cleanup: Recover cleanly from mid-batch query errors without wire-protocol desync, roll back open or aborted transactions on abrupt client disconnect, release session advisory locks, and prevent an idle transaction from blocking waiting clients indefinitely.
  • Session state reset: Reset per-session role (SET ROLE) and session-level settings (such as search_path and statement_timeout) back to a clean baseline on disconnect without losing the default search_path.
  • Zero blast radius for existing users: Keep the new multiplexing layer opt-in for the experimental SQL Connect emulator while stabilizing, leaving the existing GraphQL emulator path unchanged.

Scenarios Tested

  • Created a PGlite 0.3.3 dataDir with a table, row, and vector extension, then opened and wrote to that same dataDir under 0.3.16 (confirmed PostgreSQL 17.5, existing row and vector 0.8.0 read cleanly, new inserts succeed).
  • Verified PG16-to-PG17 migration end-to-end using installed pglite-2 (0.2.17), @electric-sql/pglite-tools@0.2.4 pgDump, and @electric-sql/pglite@0.3.16.
  • Verified all 10 bundled extensions (vector, uuid-ossp, pgcrypto, pg_trgm, citext, hstore, ltree, unaccent, btree_gin, btree_gist) load and install cleanly on 0.3.16.
  • Ran npm run sanitize:lockfile, npm run build, npm run test:compile, eslint on src/emulator/dataconnect/pgliteServer.ts (0 errors), and npx mocha 'src/dataconnect/**/*.spec.{ts,js}' (88 passing).

…ols to 0.2.4

- Pin @electric-sql/pglite to 0.3.16 (PostgreSQL 17.5) in package.json and npm-shrinkwrap.json.
- Pin @electric-sql/pglite-tools to 0.2.4 so PG16 to PG17 dataDir migration via pglite-2 (0.2.17) continues working cleanly without peer dependency conflicts.
- Update reported serverVersion in src/emulator/dataconnect/pgliteServer.ts to "17.5 (PGlite 0.3.16)".

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the @electric-sql/pglite dependency to version 0.3.16 and @electric-sql/pglite-tools to version 0.2.4 in package.json. It also updates the hardcoded server version string in pgliteServer.ts to reflect the new PGlite version. There are no review comments to address, and the changes look correct.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant